import React, {Component} from 'react'
import {
    View,
    StyleSheet,
    Image,
    Text,
    TouchableOpacity
} from 'react-native'
import Layer from "src/components/Layer"
import {inject} from "mobx-react/native"
import navigationhelper from "src/components/navigationhelper"


@inject('userAuth')
export default class MyInfo extends Component<{}> {
    render() {

        let { avatar, nick_name, real_name_status, level, real_name} = this.props.userAuth.currentUser
        let userName = real_name_status === 0 ? nick_name : real_name
        let userText = real_name_status === 0 ? '未实名认证' : '已实名认证'
        // let vipText = level === 1 ? '升级会员' : (level === 2 ? 'VIP用户' : '白金会员')
        // let typeUser = level === 1 ? '普通用户' : (level === 2 ? 'VIP用户' : '白金会员')
        return (
            <View style={[styles.container]}>
                <View style={styles.userInfo}>
                    <View style={{display: 'flex', flexDirection: 'row', alignItems: 'center'}}>
                        <Image style={{width: 70, height: 70, borderRadius: 35}}
                               source={{uri: avatar}}
                               defaultSource={require('src/assets/mine/userDefaultAvatar.png')}/>
                        <View style={{marginLeft: 9}}>
                            <Text style={{
                                fontSize: 18,
                                lineHeight: 24,
                                fontWeight:'bold',
                                fontFamily: 'PingFang SC',
                                color: '#FFFFFF'
                            }}>{userName}</Text>
                            <Text style={{
                                fontSize: 12,
                                lineHeight: 17,
                                fontFamily: 'PingFang SC',
                                color: 'rgba(255,255,255, 0.5)'
                            }}>{userText}</Text>
                        </View>
                    </View>
                    <View style={{flex: 1}}/>
                </View>
            </View>
        )
    }
}
const styles = StyleSheet.create({
    container: {
        display: 'flex',
        flexDirection: 'row',
        alignItems: 'center',
        height: 88,
        backgroundColor: 'transparent',
        marginBottom:20,
        marginTop:40
    },
    userInfo: {
        flex: 1,
        paddingLeft: 32
    },
    vip: {
        paddingLeft: 12,
        paddingRight: 16,
        display: 'flex',
        flexDirection: 'row',
        justifyContent: 'center',
        alignItems: 'center',
        width: 101,
        height: 27,
        backgroundColor: 'rgba(0,0,0, 0.15)',
        borderTopLeftRadius: 18,
        borderBottomLeftRadius: 18
    },
    vipText: {
        marginLeft: 7,
        fontSize: 12,
        fontFamily: 'PingFang SC',
        color: '#FFFFFF'
    }
})